﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace monitoring_system.Controls
{
    /// <summary>
    /// GreenProgressBar.xaml 的交互逻辑
    /// </summary>
    public partial class GreenProgressBar : UserControl
    {
        public GreenProgressBar()
        {
            InitializeComponent();
        }

        public double Value
        {
            get { return (double)GetValue(ValueProperty); }
            set { SetValue(ValueProperty, value); }
        }

        // Using a DependencyProperty as the backing store for Value.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty ValueProperty =
            DependencyProperty.Register("Value", typeof(double), typeof(GreenProgressBar), new PropertyMetadata(50.0,OnValuePropertChangedCallback));

        private static void OnValuePropertChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (d is GreenProgressBar g)
            {
                g.bar.Height=(double)e.NewValue;
            }
        }
    }
}
